﻿package mortal.game.view.guide
{
    import com.gengine.core.frame.*;
    import com.gengine.global.*;
    import com.gengine.resource.*;
    import com.gengine.resource.info.*;
    import flash.geom.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.display.*;

    public class GuideMidFlytoPack extends Object
    {
        private var _list:Array;
        private var _curFrame:int;
        private var _timer:FrameTimer;
        public static var instance:GuideMidFlytoPack = new GuideMidFlytoPack;

        public function GuideMidFlytoPack()
        {
            this._list = [];
            return;
        }// end function

        public function addNext(param1:ItemData) : void
        {
            this._list.push(param1);
            if (this._timer == null)
            {
                this._timer = new FrameTimer(4);
                this._timer.addListener(TimerType.ENTERFRAME, this.onEnterFrameHandler);
            }
            this._timer.start();
            return;
        }// end function

        private function onEnterFrameHandler(param1 = null) : void
        {
            var onLoaded:Function;
            var evt:* = param1;
            onLoaded = function (param1:ImageInfo) : void
            {
                FlyToNavbarTool.flyBitmapOriginalToPack(param1.bitmapData, new Point(Global.stage.stageWidth / 2, Global.stage.stageHeight / 2 - 50));
                return;
            }// end function
            ;
            if (this._list == null || this._list.length == 0)
            {
                if (this._timer != null)
                {
                    this._timer.stop();
                }
                return;
            }
            var itemData:* = this._list.shift();
            LoaderManager.instance.load(itemData.itemInfo.icon + ".jpg", onLoaded);
            return;
        }// end function

    }
}
